<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>JSON数据解构</title>
		<script>
			window.onload=function(){
				let jsonData = {			// 定义json变量
				  name: '刘兵',
				  age: 25,
				  like: ['羽毛球', '足球']
				};
				// 对json数据进行解构
				let { name, age, like: mylike } = jsonData;
				let myDisplay=document.getElementById("display");
				myDisplay.innerHTML = "姓名："+name+"<br>";
				myDisplay.innerHTML += "年龄："+age+"<br>";
				myDisplay.innerHTML += "爱好：";
				for(var i=0; i<mylike.length; i++){
					myDisplay.innerHTML += mylike[i]+", ";
				}				

				console.log(id, status, number);
			}
		</script>
	</head>
	<body>
		<div id="display"></div>
	</body>
</html>